home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: bitfields, how big can their elements be?
- Date: 12 Mar 1996 22:00:28 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar12150028@qcd.lanl.gov>
- References: <4i2lab$ili@hobbes.cc.uga.edu> <TANMOY.96Mar12075107@qcd.lanl.gov>
- <4i4c8dINNsde@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: c2a192@ugrad.cs.ubc.ca's message of 12 Mar 1996 09:28:45 -0800
-
- In article <4i4c8dINNsde@keats.ugrad.cs.ubc.ca>
- c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
-
- KK: In article <TANMOY.96Mar12075107@qcd.lanl.gov>,
- KK: Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
- KK: >In article <4i2lab$ili@hobbes.cc.uga.edu>
- KK: >greear@pollux.cs.uga.edu (Ben Greear) writes:
- KK: >
- KK: >BG:
- KK: >BG: Ok, i have a question on bitfields.... How big can their members be,
- KK: >
- KK: >Eacm member is valid if its width is smaller than or equal to the
- KK: >number of bits in an ordinary object of the corresponding type,
- KK: >i.e. the number of bits in an int. This number may vary from
- KK: >implementation to implementation, but is guaranteed to be at least 16.
- KK:
- KK: With GCC I tried making bitfields "long" and "short". This is an odd locution;
- KK: the compiler will actually prevent a "short" field from being more than 16
- KK: bits, but long can be 32. It's strange that the GNU compiler allows these
- KK: modifiers for bitfields! I'm going to have to look this up in the standard the
- KK: first chance I get.
-
- The standard states that any type other than int and unsigned int for
- bitfields leads to undefined behaviour. So, the compiler is allowed to
- do anything it likes: including giving it a meaning.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-